<!doctype html>
<html>
  <head>
  <link rel="icon" 
      type="image/png" 
      href="favicon.png">
      <title>fasttimesheet - attendance</title>
  	<meta http-equiv="content-type" content=""text/htm; charset=UTF-8" >
	<link href="default.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="../jquery/jquery.js"></script>
    
    
	<link href="../jquery/jquery-ui.css" rel="stylesheet" type="text/css"/>
  	<script src="../jquery/jquery-ui.min.js"></script>
  	
  	
 <link rel="stylesheet" href="../jquery-ui-1.8.4.custom.css" type="text/css" />
<link rel="stylesheet" href="../jquery/jquery.autocomplete.css" type="text/css" />
  <script type="text/javascript" src="../jquery/jquery.bgiframe.min.js"></script>
  
  <script type="text/javascript" src="jquery/jquery.autocomplete.js"></script>  	
  	<script type="text/javascript" src="../jquery/jquery.jeditable.js"></script>
  	
  	
  	
  
    <script type="text/javascript">
     
    </script>
  </head>
  <body>
  <style type="text/css">
	.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
	</style>
<script>


	
function errordialog() {
	if ($("#info").html() != "") {
	//alert ();
	$("#info").dialog({
			modal: true,
			minWidth: 400,
			buttons: {
				Ok: function() {
					$(this).dialog('close');
				}
			}
		});
	}
}


//---------------------------
function loadmonth(month) {
		$.post("../visual/admin_loadmonth.php",{ 
  			month: month,
  			year: $("#year").val(),
  			uid: $("#user").val()
  			}, 
  		function(data){
  		$("#month").html(data);	
  		attendance();
   		dayhover();
 			});
 	$("#monthholder").val(month);	
 	
	}
	
function loadmonthnumber() {
		$.post("../visual/loadmonthnumber.php", 
  		function(data){
  		//alert(data);
  		$("#monthholder").val(data);
  		return data;
  		});
 		
 		
	}

function loadyearnumber() {
		$.post("../visual/loadyearnumber.php", 
  		function(data){
  		$("#year").val(data);
  		return data;
  				});
 		
 		
	}

function initialize() {
	$.post("../visual/loadmonthnumber.php", 
  		function(data){
  		//alert(data);
  		$("#monthholder").val(data);
  		$.post("../visual/loadyearnumber.php", 
  			function(data){
  			$("#year").val(data);
  			loadmonth($("#monthholder").val());
  				});
  		});
	
	}
function validateattendance(time) {
	$.post("../core/validate_attendance_format.php",{value: time},function(data){
			//alert(data);   		
			$('#info').html(data);
			errordialog();
			loadmonth($("#monthholder").val()); 
   		}); 
	}
	
function attendance() {
	
  	note();
 	
	}
	
function note() {
	
 	
	}

function workloadcomputer(month,day,year) {
	//alert(month);
	
}




function dayhover(){
$("td").hover(function() {
		//alert('lol');
  		$(this).addClass('lit');
  		//$(this).animate({ backgroundColor: "green", opacity: 0.85 }, 50);
		}, function() {
  		$(this).removeClass('lit');
		});
 }
 
function getdetails(date,uid) {
	$.post("../visual/admin_getdetails.php",{ 
  			date: date,
  			uid: uid
  			}, 
  		function(data){
  		//alert(data);
  		$("#detailsforday").html(data);	
  		if ($("#detailsforday").html() != "") {
  		$("#detailsforday").dialog({
			modal: true,
			minWidth: 600,
			buttons: {
				Ok: function() {
					$(this).dialog('close');
					}
					}
					});
			}
			});
  	
} 
  
  
$(document).ready(function(){
	attendance();
	initialize();
	
	});
//element visualisations

$(document).ready(function() {
  	$('#loadinfo').hide();
  });

 $(document).ready(function() {
  	$('#loadinfo').ajaxStart(function() {
  	$(this).show();
  	//$(this).text('Loading');
  	//$(this).removeClass('loaded');
  	//$(this).addClass('loading');
	});
	
	$('#loadinfo').ajaxStop(function() {
	$(this).hide(50);
  	//$(this).text('Loaded');
  	//$(this).removeClass('loading');
  	//$(this).addClass('loaded');
	});
  });

$(document).ready(function(){
	
	$("#user").change(function() {
	loadmonth($("#monthholder").val());
	//alert ($("#user").val());
	});
});
</script>

<div id="leftdiv" class="maindiv">
<?php 
$user=new core_user;
echo $loc->year  ?>: <select name="year" id="year" size="1"> 
<?php 
$years=explode("-",$year_range);
for ($j = $years[0]; $j <= $years[1]; $j++) {
	echo "<option value='".$j."'>".$j."";
	} 
	
?>
</select>

 User: <select name="user" id="user" size="1"> 
<?php 
$query="select * from users";
$result=mysql_query($query);
while ($row=mysql_fetch_array($result)) {
echo "<option value='".$row['id']."'> ".$row['name']."";
}
	
?>
</select>

<h2><?php echo $loc->mnt  ?>:<h2>
<?php
for ($i=1;$i<=12;$i++) {
	echo "<h3><span class='month' onClick='loadmonth(\"".$i."\")'>".$loc->month[$i]."</span></h3>";
	
	}
?>

</div>

<div id="right">

<div class="maindiv" id="loginfo"><p class="vertcenter"><?php echo $loc->logged_user;?>: <b><?php echo $user->getUserName($_SESSION['uid']);?> </b>
<br>
<form id="logoutform" action="index.php" method="POST">
<input type="submit" name="logout" value="log out" >
</form>
</p>
</div>
<div class="separator"></div>
<div class="maindiv" id="menu" >
<form action="index.php" method="POST"><input type="hidden" name="switch" value="attend"><input type="hidden" value="attendance"></form>
<form action="index.php" method="POST"><input type="hidden" name="switch" value="main"><input type="hidden" value="tasks"></form>

<div class="maindiv" id="picker">
<form action="index.php" method="POST"><input type="submit" name="tasks" value="admin"> <input type="hidden" name="switch" value="main"></form>

</div>

</div>


<div id="info"></div>
<div class="separator"></div>
<div class="maindiv" id="month" ></div>
<input type="hidden" id="monthholder" value="">
<div title="day details" id="detailsforday"></div>

<?php
//echo date('m/d/Y');
require '../footer.php';
?>

</div>

<div class="loaded" id="loadinfo"><table><tr><td><img src="loading.gif" alt="loading"></td> <td><span id="loadtext"> Loading </span></td></tr></table></div>

<script>

</script>
</body>
</html>
